package mc.contents.util;

import com.alibaba.fastjson.JSON;
import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.ItemGetRequest;
import com.taobao.api.request.UsersGetRequest;
import com.taobao.api.response.ItemGetResponse;
import com.taobao.api.response.UsersGetResponse;

/**
 * Created by LuoHui on 14-12-5.
 */
public class TestApi {
    private static final Long itemId = 42735804225L;
    private static final String SESSIONKEY = "6102212d5b84c6cc787916409ZZe89688acb70472d919142126378287";
    private  static final TaobaoClient client=new DefaultTaobaoClient(
            "http://api.chachazhan.com:30005/",
            "12293553",
            "ee3d75affbeeaf49843a8cba06426b4a");


    public static void main( String[] args ) {
//        testOnItemGet(itemId);
    }

    public static void testOnItemGet( Long itemId){
        ItemGetRequest req=new ItemGetRequest();
        try {
            req.setFields("num_iid,title,price,sell_point,has_showcase,delist_time,create");
            req.setNumIid(itemId);
            ItemGetResponse response = client.execute(req, SESSIONKEY);
            System.out.println( JSON.toJSONString( response ));
        } catch (ApiException e) {
            e.printStackTrace();
        }
    }
}
